//同意点击事件
$(".userinfo .bx996 .agreement .consent").on('click',function(){
    //改变序号背景颜色
    $('.userinfo .bx996 ul li div:eq(0)').css({'background-color':'#cccccc'})
    $('.userinfo .bx996 ul li:eq(1) div:eq(0)').css({'background-color':'#ff9c00'})
    //改变字体颜色
    $('.userinfo .bx996 ul li div:eq(1)').css({'color':"#cccccc"})
    $('.userinfo .bx996 ul li:eq(1) div:eq(1)').css({'color':"#333333"})
    //显示隐藏
    $('.agreement,.succeed').css({'display':'none'})
    $('.information').css({'display':'block'})
})

//姓名验证
let uname1=document.querySelector('.uname1')
let uname11=document.querySelector('.uname11')
uname1.onblur=function(){
    let uname1val=this.value;
    if(uname1val){
        let uname1reg=/^[\u4e00-\u9fa5]{0,}$/
        if(!uname1reg.test(uname1val)){
            uname11.innerHTML="请输入汉字"
        }else{
            uname11.innerHTML=""
        }
    }else{
        //非空验证
        uname11.innerHTML="*用户名不能为空"
    }
}
//用户名
let uname2=document.querySelector('.uname2')
let uname22=document.querySelector('.uname22')
uname2.onblur=function(){
    let uname2val=this.value;
    if(uname2val){
        let uname2reg=/^.{3,10}$/
        if(!uname2reg.test(uname2val)){
            uname22.innerHTML="请输入3到10位字符串"
        }else{
            uname22.innerHTML=""
        }
    }else{
        //非空验证
        uname22.innerHTML="*用户名不能为空"
    }
}

//密码
let uname3=document.querySelector('.uname3')
let uname33=document.querySelector('.uname33')
uname3.onblur=function(){
    let uname3val=this.value;
    if(uname3val){
        let uname3reg=/^.{6,16}$/
        if(!uname3reg.test(uname3val)){
            uname33.innerHTML="请输入长度六到十六位的数字或英文"
        }else{
            uname33.innerHTML=""
        }
    }else{
        //非空验证
        uname33.innerHTML="*用户名不能为空"
    }
}

//确认密码
let uname4=document.querySelector('.uname4')
let uname44=document.querySelector('.uname44')
uname4.onblur=function(){
    let uname4val=this.value;
    let uname43val=uname3.value
    if(uname4val){
        if(uname4val==uname43val){
            uname44.innerHTML=""
        }else{
            uname44.innerHTML="密码不一致"
        }
    }else{
        //非空验证
        uname44.innerHTML="*用户名不能为空"
    }
}

//邮箱
let uname5=document.querySelector('.uname5')
let uname55=document.querySelector('.uname55')
uname5.onblur=function(){
    let uname5val=this.value;
    if(uname5val){
        let uname5reg=/[1-9][0-9]{4,}/
        if(!uname5reg.test(uname5val)){
            uname55.innerHTML="请输入腾讯QQ号"
        }else{
            uname55.innerHTML=""
        }
    }else{
        //非空验证
        uname55.innerHTML="*用户名不能为空"
    }
}
//手机号
let uname6=document.querySelector('.uname6')
let uname66=document.querySelector('.uname66')
uname6.onblur=function(){
    let uname6val=this.value;
    if(uname6val){
        let uname6reg=/^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/
        if(!uname6reg.test(uname6val)){
            uname66.innerHTML="请输手机号"
        }else{
            uname66.innerHTML=""
        }
    }else{
        //非空验证
        uname66.innerHTML="*用户名不能为空"
    }
}


let btn2=document.querySelector('.sbmt')
btn2.onclick=function(){
    uname1.focus();
    uname1.blur();
    uname2.focus();
    uname2.blur();
    uname3.focus();
    uname3.blur();
    uname4.focus();
    uname4.blur();
    uname5.focus();
    uname5.blur();
    uname6.focus();
    uname6.blur();
    if(uname11.innerHTML=="" && uname22.innerHTML=="" &&uname33.innerHTML=="" &&uname44.innerHTML=="" &&uname55.innerHTML=="" &&uname66.innerHTML==""){
        $(".userinfo .bx996 .information .sbmt").on('click',function(){
            //改变序号背景颜色
            $('.userinfo .bx996 ul li:eq(1) div:eq(0)').css({'background-color':'#cccccc'});
            $('.userinfo .bx996 ul li:eq(2) div:eq(0)').css({'background-color':'#ff9c00'});
            //改变字体颜色
            $('.userinfo .bx996 ul li:eq(1) div:eq(1)').css({'color':"#cccccc"});
            $('.userinfo .bx996 ul li:eq(2) div:eq(1)').css({'color':"#333333"});
            //显示隐藏
            $('.agreement,.information').css({'display':'none'});
            $('.succeed').css({'display':'block'});
       })
    }
}


let btn1=document.querySelector('.verification_code');
btn1.onclick=function(){
    this.disabled=true
    let num=60;
    btn1.value="重新获取需要"+num
    let time1=setInterval(function(){
        num--;
      btn1.value="重新获取需要"+num
      if(num==0){
        this.value="获取验证码"
        btn1.disabled=false
        clearInterval(time1)
      }
    },1000)


}





